package com.atguigu.oss.controller;

import com.atguigu.commonutils.R;
import com.atguigu.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName OssController
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/6/21
 * @Version 1.0
 */
@RestController
@RequestMapping("/eduoss/ossfile")
//@CrossOrigin
public class OssController {

    @Autowired
    OssService ossService;
    @PostMapping("/upload")
    public R uploadAvatarFile(MultipartFile file){
        String url=ossService.uploadAvatarFile(file);
        return R.ok().data("url",url);
    }
}
